package com.tzy.order.service;
import com.tzy.common.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * feign客户端通过动态代理; 出错的概率小一些
 */
@FeignClient(name = "order",fallback = UserServiceFallback.class)
@Component//标识为组件
public interface UserService {
    //映射地址, 通过反射获取 ServiceId,url ,Class
    @GetMapping("/user/info/{id}")
    User getUserInfoById(@PathVariable("id") int serviceId);
    @PutMapping("/user/add")
    int insert(@RequestBody User user);
}
